package wili.attrMapping.core.del;

import java.util.List;

import wili.a.Refs;
import wili.attrMapping.core.Atts;
import wili.attrMapping.core.AttsDefine;
import wili.attrMapping.core.AttsFile;
import wili.c.Ca;
import wili.c.Class9a;

/**
 * 属性bean
 * 
 * @author weilai2@163.com
 */
@Deprecated
public abstract class AttsBean extends Atts {
	/*
		属性bean vs 属性对象
		
	 */
	/**
	 * 
	 * @param def
	 * @param file
	 * @param keyValue
	 * @param obj
	 * @param isNew
	 */
	public AttsBean(AttsDefine def, AttsFile file, String keyValue, Object obj, boolean isNew) {
		super(def, file, keyValue, obj, isNew);
		Ca.asert(Refs.useAttsBean(), "");

	}

	public static AttsBean newInst(Class<? extends AttsBean> cls, AttsDefine def, AttsFile afile, String key,
			Object obj, boolean isNew) {
		AttsBean ret = Class9a.newInst(cls, def, afile, key, obj, isNew);
		return ret;
	}

	public final List<Atts> findNewAttsList() {
		if (this.isNewAtts)
			return null;
		List<Atts> ret = conf.findNewAttsList(this);
		return ret;
	}

	public String valueOf(String att) {
		try {
			return (String) this.getClass().getDeclaredField(att).get(this);
		} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
			e.printStackTrace();
			return null;
		}
	}

	@Override
	public void updateValue(String va) {
		Ca.asert(false, "todo");

	}

	@Override
	public void addNewAtt(Atts atts) {
		Ca.asert(false, "todo");

	}

	@Override
	public void updateNewAtts(String aa) {
		Ca.asert(false, "todo");

	}

	public abstract String valueKindOfAtt(String att);
}
